package com.test.mooan.labama.utils_boom;

import android.content.res.Resources;

public class SizeUtils {

    public static int spToPx(float spV){
        return (int) (spV * Resources.getSystem().getDisplayMetrics().scaledDensity);
    }

    public static int dpToPx(float dpV){
        return (int) (dpV * Resources.getSystem().getDisplayMetrics().density + 0.5f);
    }

    public static float pxToDp(int pxV){
        return pxV / Resources.getSystem().getDisplayMetrics().density;
    }

    public static float pxToSp(int pxV){
        return pxV / Resources.getSystem().getDisplayMetrics().scaledDensity;
    }

    public static int readScreenWidth(){
        return Resources.getSystem().getDisplayMetrics().widthPixels;
    }

    public static int readScreenHeight(){
        return Resources.getSystem().getDisplayMetrics().heightPixels;
    }

    public static float gtScreenWidthDp(){
        return pxToDp(readScreenWidth());
    }

    public static float gtScreenHeightDp(){
        return pxToDp(readScreenHeight());
    }

}
